<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 刘洪兆0720
  Date: 2022/5/13
  Time: 7:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>导出信息</title>

    <link rel="stylesheet" href="${path}/static/bootstrap/css/bootstrap.min.css">
    <script src="${path}/static/bootstrap/js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="${path}/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-collapse collapse">
        <div class="container">
            <ul class="nav navbar-nav">
                <li style="font-size: 18px; text-color: #ffffff;"><a>上机考试系统</a></li>
                <li><a href="teacher_home.jsp">首页 </a></li>
                <li><a href="teacher_exam_before.jsp">考前操作 </a></li>
                <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">考中管理<b
                        class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="${path}/goStudentInfo?id=1">考试概况</a></li>
                        <li><a href="${path}/goStudentInfo?id=2">学生信息</a></li>
                        <li><a href="${path}/goStudentInfo?id=3">解除锁定</a></li>
                        <li><a href="${path}/goStudentInfo?id=4">通知管理</a></li>
                    </ul>
                </li>
                <li><a href="teacher_exam_after.jsp"> 考后操作 </a></li>
            </ul>
            <ul class="nav navbar-nav" style="float: right">
                <li><a>欢迎您，${teaName}</a></li>
                <li><a href="" data-toggle="modal" data-target="#myModal">
                    修改密码 </a></li>
                <li><a href="${path}/exit">退出 </a></li>
            </ul>
        </div>
    </div>
</nav>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 300px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">&times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    <b>修改密码</b>
                </h4>
            </div>
            <form action="${path}/exitTeacher" method="post">
                <div class="alert navbar-inverse "
                     style="background-color: #eeeeee; height: auto; margin-top: 20px;">
                    <input style="width: 250px" name="oldPwd" type="password"
                           placeholder="原密码" class="form-control"> <br/>
                    <input
                            type="password" style="width: 250px" placeholder="新密码"
                            name="newPwd1" class="form-control"> <br/>
                    <input
                            type="password" style="width: 250px" placeholder="重新输入新密码"
                            name="newPwd2" class="form-control"> <br/>
                    <button type="submit" style="width: 250px" class="btn btn-primary">确定修改</button>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="container">
    <div>
        <hr style="background-color: #21231d; height: 3px; border: none; margin-top: 40px"/>
    </div>

    <div class="alert navbar-inverse" style="margin-top: 50px;">
        <a href="teacher_exam_after.jsp" class="btn btn-primary btn-block"><span
                class="glyphicon glyphicon-pencil"></span>返回</a>
    </div>


    <div class="row" style="margin-top: 5px;background-color: #eeeeee;">
        <div class="btn-group" style="margin-top: 5px;">
            <a href="" id="export" target="_blank" class="btn btn-default btn-sm"
               style="background-color: #5ea2dc; font-size: 18px;color: white">导出数据</a>
            <button type="button" class="btn btn-default" onclick="deleteExam()"
                    style="position: relative;left: 50px;background-color: #5ea2dc;font-size: 18px;color: white">删除该门考试
            </button>
        </div>
    </div>

    <div class="alert navbar-inverse"
         style="background-color: #eeeeee; margin-top: 20px">
        <strong style="margin-left: 20px; font-size: 18px;display: block">当前科目: <span
                id="e_name">${name}</span></strong>

        <form class="form-inline form-inline1" role="form" style="margin-left: 20px; margin-top: 5px;">
            <div class="form-group">
                <input type="text" class="form-control" style="width: 250px" placeholder="学号*" name="stu_id">
                <input type="submit" class="btn btn-info" value="查找" style="background-color: #2a6496;"/>
                <input type="text" style="display:none;" name="exam_name" id="examName" value="${name}"/>
                <input type="text" style="display:none;" name="tea_name" id="teaName" value="${teaName}"/>
            </div>
        </form>
    </div>


    <table class="table table-bordered" style="margin-top: 10px; text-align: center">
        <thead>
        <tr>
            <th class="col-md-2">学号</th>
            <th class="col-md-2">考试科目</th>
            <th class="col-md-2">上传文件名</th>
            <th class="col-md-2">文件大小</th>
            <th class="col-md-3">提交时间</th>
        </tr>
        </thead>
        <tbody id="tbody">
        <c:forEach items="${answerList}" var="u">
            <tr>
                <td>${u.stu_id}</td>
                <td>${name}</td>
                <td>${u.file_name}</td>
                <td>${u.file_size}</td>
                <td>${u.times}</td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
</body>
<script>
    var name = document.getElementById("examName").value;
    var teaName = document.getElementById("teaName").value;

    function deleteExam() {
        $.post("${path}/clearExam", {"name": name, "teaName": teaName}, function (data) {
                alert("清理成功")
            }
        );
    }

    $("#export").click(function () {
        //设置linkToCart的href的值
        $("#export").attr("href", "${path}/exportExam?name=" + name + "&teaName=" + teaName);
    });
</script>
</html>
